import request from '@/common/request.js'

// 获取动态详情
export function getPostsInfo(params = {}) {
  return request.httpTokenRequest({
    url: '/api/index/getPostsInfo',
    method: 'get',
    data: params
  })
}

// 获取评论列表
export function saveComments(params = {}) {
  return request.httpTokenRequest({
    url: '/api/index/saveComments',
    method: 'get',
    data: params
  })
}

export function getComments(params = {}) {
  return request.httpTokenRequest({
    url: '/api/index/getComments',
    method: 'get',
    data: params
  })
}

// 点赞/取消点赞
export function saveLikes(params = {}) {
  return request.httpTokenRequest({
    url: '/api/index/saveLikes',
    method: 'get',
    data: params
  })
}

// 发布动态
export function savePosts(params = {}) {
  return request.httpTokenRequest({
    url: '/api/index/savePosts',
    method: 'post',
    data: params
  })
}

// 删除动态
export function deleteDynamic(params = {}) {
  return request.httpTokenRequest({
    url: '/api/index/deletePosts',
    method: 'get',
    data: params
  })
}

// 举报动态
export function reportDynamic(params = {}) {
  return request.httpTokenRequest({
    url: '/api/index/saveReport',
    method: 'get',
    data: params
  })
}
// 修改动态是否可见
export function updateDynamicVisible(params = {}) {
  return request.httpTokenRequest({
    url: '/api/index/updatePosts',
    method: 'get',
    data: params
  })
}
